<template>
  <div>
    <button
      type="button"
      @click="$localStorage.setItem('a', (++count).toString())"
    >
      count is {{ count }}
    </button>
  </div>
</template>
<script setup lang="ts">
import { ref } from 'vue'
import { useStorage } from '@/hooks/localStorage/useLocalStorage'

const count = ref(0)
const key = useStorage('a')
console.log('key', key)
watch(
  () => key,
  (a) => {
    console.log(`监听 localStorage -> ${key}`, a)
  },
)
</script>
